<template>
	<scroll-view :scroll-y="true" class="wrapper" :show-scrollbar="false">
		<u-grid :col="2">
			<mod-item v-for="(item,index) in libMenu" :item="item" :key="index"></mod-item>
		</u-grid>

		<view class="inter-conf">
			<text>每模块{{count}}题  /  难度：{{level}}</text>
			<u-input v-model="count" type="number" :border="border" />
			<u-select v-model="showActionSheet" :list="actionSheetList" @confirm="actionSheetCallback"></u-select>
			<u-button @click="showActionSheet = true">选择难度</u-button>
		</view>

		<u-button class="btn-start" type="primary" @click="startInterview">开始面试</u-button>

		<u-action-sheet :list="actionSheetList" :v-model="showActionSheet"
			@click="actionSheetCallback"></u-action-sheet>
	</scroll-view>

</template>

<script>
	import {
		mapState
	} from "vuex"

	export default {
		name: "mod-conbination",
		data() {
			return {
				count: 5,
				level: '适中',

				show: false,
				showActionSheet: false,
				border: true,

				actionSheetList: [
					{
						value: '1',
						label: '简单'
					},
					{
						value: '2',
						label: '适中'
					},
					{
						value: '3',
						label: '困难'
					}
				],

			};
		},

		computed: mapState(["libMenu"]),

		methods: {
			startInterview() {
				uni.navigateTo({
					url:"/pages/exam/exam"
				})
			},

			toggleActionSheet(e) {
				console.log("toggleActionSheet");
				this.showActionSheet = !this.showActionSheet
			},

			// 点击actionSheet回调
			actionSheetCallback(e) {
				console.log("actionSheetCallback", e);
				this.level = e[0].label;
			}
		}

	}
</script>

<style lang="scss">
	.wrapper {
		height: calc(100vh - 180rpx);
		padding: 10rpx;
		// padding-right: 15rpx;
		padding-bottom: 100rpx;
		box-sizing: border-box;
		// background-color: aliceblue;

		u-grid {
			// display: block;
			// width: 100%;
			// height: 100%;
			// box-sizing: border-box;
			// padding: 10rpx;
		}

		.inter-conf {
			padding: 15rpx;
			border: 1px solid #eee6;
			margin: 20rpx 0;
			display: flex;
			flex-direction: column;
			// align-items: center;
			// justify-content: space-between;

			text {
				text-align: center;
				font-size: 1rem;
				height: 50rpx;
				line-height: 50rpx;
			}

			u-input {
				margin-bottom: 10rpx;
			}
		}

		.btn-start {
			display: block;
			// height: 100rpx !important;
			// line-height: 100rpx !important;
			width: calc(100% - 25rpx);
			margin: 30rpx auto;
		}
	}
</style>